package com.example.demo.domain.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.sql.Date;


@TableName(value = "borrow", schema = "db_example")
public class BorrowEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(type = IdType.AUTO)
    private Long id;
    @TableField("bookName")
    private String bookName;
    @TableField("Username")
    private String username;
    @TableField("Phone")
    private String phone;
    private Date start;
    private Date end;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Date getStart() {
        return start;
    }

    public void setStart(Date start) {
        this.start = start;
    }

    public Date getEnd() {
        return end;
    }

    public void setEnd(Date end){
        this.end = end;
    }
    public void setNewEnd(int day) {
        long startMillis = start.getTime();
        long endMillis = startMillis + (day * 24L * 60 * 60 * 1000); // 加上 30 天的毫秒数
        this.end = new Date(endMillis);
    }
}
